﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace HYCodeBase.AsyncUtility.AsyncSupport
{
	internal class AllWaitHalfNSquareSupport : HalfNSquareSupport
	{
		public AllWaitHalfNSquareSupport(IList<IElement> inputLstElement, int? useThreadCount) : base(inputLstElement, useThreadCount)
		{
		}

		public override void Calculate()
		{
			List<Task> list = new List<Task>();
			for (int i = 0; i < this.m_lstUseElment.Count; i++)
			{
				list.Add(Task.Factory.StartNew(new Action<object>(base.CalculateByOneRow), i));
			}
			Task.WaitAll(list.ToArray());
		}
	}
}
